<template>
  <div id="Shop">
    <v-header3 :title="shopDeatil.storeName"></v-header3>
    <v-shopInfo
      :storeDoorHearImg="shopDeatil.storeDoorHearImg"
      :title="shopDeatil.storeName"
      :storeLevel="shopDeatil.storeLevel"
      :mainBrandVos="shopDeatil.mainBrandVos"
      :storeAddress="shopDeatil.storeAddress"
      :storeVideo="shopDeatil.storeVideo"
      :storeHeadImg="shopDeatil.storeHeadImg"
    ></v-shopInfo>
    <v-onSale
      :goodsVo="shopDeatil.goodsVo"
      :inSaleGoodsNum="shopDeatil.inSaleGoodsNum"
      :miniStoreId="shopDeatil.miniStoreId"
    ></v-onSale>
    <v-reputation
      :soldGoodsNum="shopDeatil.soldGoodsNum"
      :storeCreditScore="shopDeatil.storeCreditScore"
    ></v-reputation>
    <v-shopFooter></v-shopFooter>
  </div>
</template>
<script>
import vHeader3 from "../components/common/Header3";
import vShopInfo from "../components/Shop/ShopInfo";
import vOnSale from "../components/Shop/OnSale";
import vReputation from "../components/Shop/Reputation";
import vShopFooter from "../components/Shop/ShopFooter";
import { getReq } from "../assets/js/api";
import { Toast } from "mint-ui";
import dict from "../assets/js/utils";
export default {
  name: "Shop",
  data() {
    return {
      miniStoreId: this.$route.query.miniStoreId,
      shopDeatil: {
        miniStoreId: 0,
        storeShareUrl: null,
        storeDoorHearImg: [
          {
            id: null,
            storeImgUrl: ""
          }
        ],
        storeHeadImg: "",
        storeVideo: {
          id: 0,
          thumbnailUrl: "",
          fileUrl: ""
        },
        storeName: "",
        mainCarGradeVos: [
          {
            carGradeId: 0,
            carGradeName: ""
          }
        ],
        mainBrandVos: [
          {
            brandId: 0,
            brandName: ""
          }
        ],
        storePhone: "",
        storeAddress: "",
        inSaleGoodsNum: 0,
        goodsVo: [
          {
            goodsId: 0,
            imgUrl: "",
            carModelName: "",
            retailPrice: 0,
            carCityName: "",
            registerTime: "",
            mileage: 0,
            dischargeLevel: "",
            isConsignment: 0,
            accidentType: 0,
            updateTime: "",
            goodsStatus: 0
          }
        ],
        soldGoodsNum: 0,
        storeCreditScore: 0,
        storeDetailEvaluateVo: {
          askInTime: 0,
          credit: 0,
          dealFast: 0,
          conditionGood: 0,
          patience: 0,
          goodAttitude: 0
        },
        storeLevel: "",
        bindStatus: 0,
        jobId: null,
        jobPhone: null,
        jobStatus: 0
      }
    };
  },
  components: {
    vHeader3,
    vShopInfo,
    vOnSale,
    vReputation,
    vShopFooter
  },
  methods: {
    getShopDeatil() {
      var params = {
        miniStoreId: this.miniStoreId
      };
      getReq("/b2c/store/getStoreDetailInfo", params).then(res => {
        let { errcode, message, content } = res;
        if (errcode == 0) {
          this.shopDeatil = content;
          this.shopDeatil.storeLevel =
            dict.storeLevel[this.shopDeatil.storeLevel];
          if (this.shopDeatil.goodsVo > 0) {
            this.shopDeatil.goodsVo.map((item, index) => {
              item.dischargeLevel = dict.dischargeLevel[item.dischargeLevel];
            });
          }
        } else {
          Toast({
            message: message
          });
        }
      });
    }
  },
  created() {
    this.$nextTick(() => {
      this.getShopDeatil();
    });
  }
};
</script>
<style type="text/css" lang='scss'>
#Shop {
  padding-bottom: 46px;
}
</style>


